////////////////////////////////////////////////////////////////////////////////
//
//  The ffi Document Processor
//  Copyright (C) 2012 by Kevin Carlson. All rights reserved.
//
//  This application is released under the terms of the Simplified (2-clause)
//  BSD License. For details, see the LICENSE file in the source distribution.
//
////////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include "ffiParagraphStyle.h"

using namespace std;

FfiParagraphStyle::FfiParagraphStyle()
{
    
}

FfiParagraphStyle::FfiParagraphStyle(const FfiParagraphStyle& orig)
{
    
}

FfiParagraphStyle::~FfiParagraphStyle()
{
    
}

bool FfiParagraphStyle::getAllowParagraphSplit()
{
    return allowParagraphSplit;
}

bool FfiParagraphStyle::getDropCapsAffectsWholeWord()
{
    return dropCapsAffectsWholeWord;
}

bool FfiParagraphStyle::getEmphasized()
{
    return emphasized;
}

bool FfiParagraphStyle::getHyphenate()
{
    return hyphenate;
}

bool FfiParagraphStyle::getKeepWithNextParagraph()
{
    return keepWithNextParagraph;
}

bool FfiParagraphStyle::getOrphanControl()
{
    return orphanControl;
}

bool FfiParagraphStyle::getRegisterTrue()
{
    return registerTrue;
}

bool FfiParagraphStyle::getSmallCaps()
{
    return smallCaps;
}

bool FfiParagraphStyle::getStrikeout()
{
    return strikeout;
}

bool FfiParagraphStyle::getStrong()
{
    return strong;
}

bool FfiParagraphStyle::getSubscript()
{
    return subscript;
}

bool FfiParagraphStyle::getSuperscript()
{
    return superscript;
}

bool FfiParagraphStyle::getUnderline()
{
    return underline;
}

bool FfiParagraphStyle::getUseDropCaps()
{
    return useDropCaps;
}

bool FfiParagraphStyle::getWidowControl()
{
    return widowControl;
}

int FfiParagraphStyle::getCharactersForDropCaps()
{
    return charactersForDropCaps;
}

int FfiParagraphStyle::getMinimumCharactersAfterHyphenation()
{
    return minimumCharactersAfterHyphenation;
}

int FfiParagraphStyle::getMinimumCharactersBeforeHyphenation()
{
    return minimumCharactersBeforeHyphenation;
}

int FfiParagraphStyle::getOrphanThreshold()
{
    return orphanThreshold;
}

int FfiParagraphStyle::getWidowThreshold()
{
    return widowThreshold;
}


double FfiParagraphStyle::getFontSize()
{
    return fontSize;
}

double FfiParagraphStyle::getHorizontalSpacing()
{
    return horizontalSpacing;
}

double FfiParagraphStyle::getIndentFirstLine()
{
    return indentFirstLine;
}

double FfiParagraphStyle::getIndentLeft()
{
    return indentLeft;
}

double FfiParagraphStyle::getIndentRight()
{
    return indentRight;
}

double FfiParagraphStyle::getSpacingBottom()
{
    return spacingBottom;
}

double FfiParagraphStyle::getSpacingTop()
{
    return spacingTop;
}

double FfiParagraphStyle::getVerticalSpacing()
{
    return verticalSpacing;
}


string FfiParagraphStyle::getFontFace()
{
    return fontFace;
}

string FfiParagraphStyle::getStyleName()
{
    return styleName;
}


void FfiParagraphStyle::setAllowParagraphSplit(bool newValue)
{
    allowParagraphSplit = newValue;
    
    if (allowParagraphSplit==false)
    {
        this->setOrphanControl(false);
        this->setWidowControl(false);
    }
}

void FfiParagraphStyle::setCharactersForDropCaps(int newValue)
{
    charactersForDropCaps = newValue;
}

void FfiParagraphStyle::setDropCapsAffectsWholeWord(bool newValue)
{
    dropCapsAffectsWholeWord = newValue;
}

void FfiParagraphStyle::setEmphasized(bool newValue)
{
    emphasized = newValue;
}

void FfiParagraphStyle::setFontFace(string newValue)
{
    //////////////////////////////////////////////////////////
    //                                                      //
    //  TODO: Implement a form of error-checking for this.  //
    //                                                      //
    //////////////////////////////////////////////////////////
    
    fontFace = newValue;
}

void FfiParagraphStyle::setFontSize(double newValue)
{
    if (newValue > 0)
        fontSize = newValue;
    else
        cout << "call to setFontSize passed an invalid value.\n";
}

void FfiParagraphStyle::setHorizontalSpacing(double newValue)
{
    horizontalSpacing = newValue;
}

void FfiParagraphStyle::setHyphenate(bool newValue)
{
    hyphenate = newValue;
}

void FfiParagraphStyle::setIndentFirstLine(double newValue)
{
    indentFirstLine = newValue;
}

void FfiParagraphStyle::setIndentLeft(double newValue)
{
    indentLeft = newValue;
}

void FfiParagraphStyle::setIndentRight(double newValue)
{
    indentRight = newValue;
}

void FfiParagraphStyle::setKeepWithNextParagraph(bool newValue)
{
    keepWithNextParagraph = newValue;
}

void FfiParagraphStyle::setMinimumCharactersAfterHyphenation(int newValue)
{
    if (newValue > 0)
        minimumCharactersAfterHyphenation = newValue;
    else
        cout << "call to setMinimumCharactersAfterHyphenation passed an invalid value.\n";
}

void FfiParagraphStyle::setMinimumCharactersBeforeHyphenation(int newValue)
{
    if (newValue > 0)
        minimumCharactersBeforeHyphenation = newValue;
    else
        cout << "call to setMinimumCharactersBeforeHyphenation passed an invalid value.\n";
}

void FfiParagraphStyle::setOrphanControl(bool newValue)
{
    orphanControl = newValue;
    
    if (orphanControl==true)
    {
        this->setAllowParagraphSplit(true);
    }
}

void FfiParagraphStyle::setOrphanThreshold(int newValue)
{
    if (newValue > 0)
        orphanThreshold = newValue;
    else
        cout << "call to setOrphanThreshold passed an invalid value.\n";
}

void FfiParagraphStyle::setRegisterTrue(bool newValue)
{
    registerTrue = newValue;
}

void FfiParagraphStyle::setSmallCaps(bool newValue)
{
    smallCaps = newValue;
}

void FfiParagraphStyle::setSpacingBottom(double newValue)
{
    spacingBottom = newValue;
}

void FfiParagraphStyle::setSpacingTop(double newValue)
{
    spacingTop = newValue;
}

void FfiParagraphStyle::setStrikeout(bool newValue)
{
    strikeout = newValue;
}

void FfiParagraphStyle::setStrong(bool newValue)
{
    strong = newValue;
}

void FfiParagraphStyle::setStyleName(string newValue)
{
    styleName = newValue;
}

void FfiParagraphStyle::setSubscript(bool newValue)
{
    subscript = newValue;
}

void FfiParagraphStyle::setSuperscript(bool newValue)
{
    superscript = newValue;
}

void FfiParagraphStyle::setUnderline(bool newValue)
{
    underline = newValue;
}

void FfiParagraphStyle::setUseDropCaps(bool newValue)
{
    useDropCaps = newValue;
}

void FfiParagraphStyle::setVerticalSpacing(double newValue)
{
    verticalSpacing = newValue;
}

void FfiParagraphStyle::setWidowControl(bool newValue)
{
    widowControl = newValue;
    
    if (widowControl==true)
    {
        this->setAllowParagraphSplit(true);
    }
}

void FfiParagraphStyle::setWidowThreshold(int newValue)
{
    if (newValue > 0)
        widowThreshold = newValue;
    else
        cout << "call to setWidowThreshold passed invalid value.\n";
}
